import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import test.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2023-01-16
 * Time:17:11
 */

public class App {
    //    public static void main(String[] args) {
//        //得到上下文
//        ApplicationContext context=new ClassPathXmlApplicationContext("spring-config.xml");
//        //获取bean对象
//        User user=(User)context.getBean("user");
//        user.sayHi();
//    }

    public static void main(String[] args) {
//        ApplicationContext context=new ClassPathXmlApplicationContext("spring-config.xml");
//        ControllerTest test=context.getBean("controllerTest", ControllerTest.class);
//        test.aaa();
//        User user=context.getBean("user", User.class);
//        System.out.println(user.getId());
        ApplicationContext context=new ClassPathXmlApplicationContext("spring-config.xml");
        ControllerTest test=context.getBean("controllerTest",ControllerTest.class);
        test.test();
//        test.aaa();
//        RepositoryTest repositoryTest=context.getBean("repositoryTest", RepositoryTest.class);
//        repositoryTest.test();
//        User user=context.getBean("user",User.class);
//        System.out.println(user.getAge());
//        System.out.println(user.toString());
    }
}
